package com.ethink.order.api;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ethink.order.api.info.SaleDemandOrderDetailInfo;
import com.ethink.order.api.info.SaleDemandOrderInfo;
import com.ethink.order.api.info.SaleDemandOrderModeInfo;
import com.ethink.order.api.model.PreSuppleOrderDetailModel;
import com.ethink.order.api.request.*;
import com.ethink.order.api.response.SaleConfirmPurchaseResponse;
import com.ethink.order.api.response.SaleDemandOrderAddResponse;
import com.ethink.order.api.response.SaleDemandOrderDeleteResponse;
import com.ethink.order.api.response.SaleDemandOrderDetailResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 销售需求单 Facade接口
 *
 * @author default
 * @date 2022-10-31
 */
@FeignClient(name = "ethink-order-service", path = "order-service/facade/v1/saleDemandOrder", contextId = "saleDemandOrderFacade")
public interface SaleDemandOrderFacade {

    @PostMapping("/querySaleDemandOrder")
    @ResponseBody
    Page<SaleDemandOrderInfo> querySaleDemandOrder(@RequestBody SaleDemandOrderQueryRequest request);

    /**
     * 销售需求详情查询
     * @param orderNo
     * @return
     */
    @GetMapping("/getSaleDemandOrderByNo")
    @ResponseBody
    SaleDemandOrderDetailResponse getSaleDemandOrderByNo(@RequestParam("orderNo") String orderNo);

    @PostMapping("/listSaleDemandOrder")
    @ResponseBody
    List<SaleDemandOrderInfo> listSaleDemandOrder(@RequestBody SaleDemandOrderQueryRequest request);

    @PostMapping("/addSaleDemandOrder")
    @ResponseBody
    SaleDemandOrderAddResponse addSaleDemandOrder(@RequestBody SaleDemandOrderAddRequest request);

    @GetMapping("/deleteSaleDemandOrder")
    @ResponseBody
    SaleDemandOrderDeleteResponse deleteSaleDemandOrder(@RequestParam("saleDemandOrderId") Long saleDemandOrderId);

    @PostMapping("/confirm")
    @ResponseBody
    void demandConfirm(@RequestBody SaleDemandOrderConfirmRequest request);

    @PostMapping("/lock")
    @ResponseBody
    void lock(@RequestBody SaleDemandOrderLockRequest request);

    @GetMapping("/unlock")
    @ResponseBody
    void unlock(@RequestParam("id") Long id);

    @PostMapping("/oaPass")
    @ResponseBody
    SaleConfirmPurchaseResponse oaPass(@RequestBody OAPassRequest request);

    @PostMapping("/pageQueryByPreSupple")
    @ResponseBody
    Page<PreSuppleOrderDetailModel> pageQueryByPreSupple(@RequestBody PreSupplePageQueryRequest request);

    @PostMapping("/update")
    @ResponseBody
    String update(@RequestBody SaleDemandOrderUpdateRequest request);

    @PostMapping("/updateRemark")
    @ResponseBody
    Integer updateRemark(@RequestBody SaleDemandUpdateRemarkRequest request);

    @PostMapping("/updateConfirm")
    @ResponseBody
    Integer demandConfirmUpdate(@RequestBody SaleDemandOrderUpdateConfirmRequest request);

    /**
     * 根据订单编号查询 销售需求主数据
     * @param orderNo
     * @return
     */
    @GetMapping("/queryMainByOrderNo")
    @ResponseBody
    SaleDemandOrderInfo queryMainByOrderNo(@RequestParam("orderNo") String orderNo);

    @GetMapping("/queryItemByDetailOrderNo")
    @ResponseBody
    SaleDemandOrderDetailInfo queryItemByDetailOrderNo(@RequestParam("detailOrderNo") String detailOrderNo);

    @GetMapping("/queryMainByDetailId")
    @ResponseBody
    SaleDemandOrderInfo queryMainByDetailId(@RequestParam("id") Long id);

    @GetMapping("/queryDetailByDetailId")
    @ResponseBody
    SaleDemandOrderDetailInfo queryDetailByDetailId(@RequestParam("id") Long id);

    @PostMapping("/querySaleDemandOrderMode")
    @ResponseBody
    Page<SaleDemandOrderModeInfo> querySaleDemandOrderMode(@RequestBody SaleDemandOrderQueryModeRequest request);

}